Repository navigation
Conversation
A finding carries the keyed blake3 of its rule, its path from the root of the project and the normalized text of its line and its nearest non-blank neighbors, as ADR 0019 decision 5 sets. The line number is not an input, so the fingerprint stays when the lines above the finding move. A finding about a whole file hashes three empty lines; a finding about a whole change or a message hashes its normalized message. The json output gains the key `fingerprint` on each diagnostic, and the sarif output `partialFingerprints` with `boticaFinding/v1`. BOTICA_HISTORY_KEY keys the hash; a value shorter than 32 bytes leaves the fingerprints out with a warning, and extension processes no longer inherit the variable.
…rom ext sync With `--judged --staged`, the fingerprint of a finding now reads the file from the index, as ADR 0019 decision 5 sets, and not from the working tree. `botica ext sync` no longer passes BOTICA_HISTORY_KEY to the process it starts.
A line 0 or past the end of the text gives the fingerprint of a finding about the whole file, and a `--staged` run hashes the staged text and not the working tree.
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Each finding of
botica lintgets the fingerprint of ADR 0019 decision 5, and the json and sarif outputs carry it.json: {"rule", "code", "standard", "severity", "path", "range", "message", + "fingerprint": "fc6c37b1e6a10db3" | null} sarif: result { + "partialFingerprints": {"boticaFinding/v1": "fc6c37b1e6a10db3"}}crates/botica-core/src/fingerprint.rs:FingerprintKey(key, hash,stamp).blake3stops being optional inbotica-core.crates/botica-cli/src/lint_cmd/fingerprints.rs: stamps the final findings, only for json and sarif. The text is the one the run linted. A path that the run did not read (--judged) is read from the index with--stagedand from disk otherwise.BOTICA_HISTORY_KEYis removed from the environment of extension processes (ExtensionHost::spawn_withandbotica ext sync).Contract change: the json output gains the key
fingerprint(schema_versionstays 1, since a key is added and none changes meaning), and the sarif output gainspartialFingerprints. The golden testsjson_carries_the_schema_version_…andsarif_lists_the_rules_…ofcrates/botica-core/tests/report.rswere updated..abide/rubric.jsonis regenerated because it lists the newfingerprint.rs.Related issues
Issue 06 of the review flow (fingerprint per finding). Design: ADR 0019 decision 5 (#297). Stacked on #298.
Differences between the issue and the ADR, where the ADR wins:
BOTICA_HISTORY_KEY), the length prefix of each field, and that the neighbors are the nearest non-blank lines, and those are what this PR does.7d68e2a43cb6636apins this reading.review:<role>, title as message) are not here:--revieweddoes not exist yet.Evidence
botica lint --output-format jsonhas no fingerprint; nothing pairs a finding of one run with the same finding after the lines above it moved.cargo test -p botica-cli --test fingerprint: 11 passed, among thema_finding_that_moves_down_keeps_its_fingerprint(the issue's test, through the binary),an_edit_of_the_line_gives_a_new_fingerprint,sarif_carries_the_same_fingerprint_as_json,the_path_is_taken_from_the_root_of_the_project_whatever_the_working_directory,a_staged_run_hashes_the_staged_text_and_not_the_working_tree,a_judged_finding_of_a_staged_run_hashes_the_staged_text_…(fails with the staged read turned off),an_extension_process_does_not_inherit_the_key.cargo test -p botica-core --test fingerprint: 13 passed, with fixed vectors computed apart with theblake3package of Python (.tmp/vectors.py, not committed): unkeyed linefc6c37b1e6a10db3, keyed line2f92438af2df38b3, whole file3859838336ed4b85, message7d68e2a43cb6636a.cargo fmt --all,cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo test --workspace --locked --no-fail-fast: no failure.prek run --files <changed files>: passed.botica lintreportsfile-size-guardwarnings onlint_cmd.rs,eager_test.rsandbotica-lsp/tests/common/mod.rs, which were already over 400 lines before this change.Review panel
Two rounds of review-panel (spec, security, tests, architecture, contracts, performance, then refute). Neither round had a P0 or P1.
Fixed:
--judged --stagedhashed the working tree and not the staged text.--judgedrun.botica ext syncpassed the key to the process that it starts.--judged.Left, with their severity:
occurrence, a key of the history line that the writer PR adds. SARIF consumers that match bypartialFingerprintswill merge them.key_id). It belongs to the run line of the history writer.BOTICA_HISTORY_KEY, json and sarif carry unkeyed fingerprints, which can confirm a guessed secret of low entropy on a flagged line. ADR 0019 decision 5 accepts this when the variable is unset.botica ext syncdrops the key.compiledAt/compiledByof the regenerated rubric changed.FingerprintKey::from_envis the one read of the environment inbotica-core; the variable name lives inbotica-extbecause both crates need it andbotica-extcannot depend onbotica-core;fingerprints.rsborrowsbaseline::from_root; "fingerprint" also names the key of the result cache, andGLOSSARY.mddefines neither;Read::Messagescallsof_messageitself.Decisions taken
fingerprintis always present in json,nullwhen a finding has none, ascodeandstandardare.schema_versionstays 1.boticaFinding/v1, versioned as SARIF 3.27.17 asks.BOTICA_HISTORY_KEYshorter than 32 bytes leaves every fingerprint out with a warning on stderr, and the exit code stays as it was. ADR 0019 calls it a history that cannot be written; there is no history yet, so the output drops the field.Merge Danger
Door: two-way. The output gains keys; nothing is removed or renamed.
Blast Radius: consumers of the json and sarif outputs (a strict reader of the json that rejects unknown keys), and GitHub code scanning, which reads
partialFingerprintsto match alerts from one upload to the next. Extensions that readBOTICA_HISTORY_KEYfrom their environment no longer see it.Rollback: revert the PR. No stored state changes; the result cache keeps diagnostics with
fingerprintskipped when it isNone.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.